package com.yunshipei.common.wedigt;

import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.widget.TextView;

import com.yunshipei.common.manager.EnterConfig;
import com.yunshipei.enterplorer.R;
import com.yunshipei.utils.DrawableUtils;


public class YspTextView extends TextView {

    public YspTextView(Context context) {
        this(context, null);
    }

    public YspTextView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public YspTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init(context);
    }

    @TargetApi(16)
    private void init(Context context) {
        if (isInEditMode()) {
            return;
        }
        int color = EnterConfig.getInstance().getGlobalColor();
        int radio = context.getResources().getDimensionPixelOffset(R.dimen.btn_radio_size);
        Drawable normalState = DrawableUtils.newRadioDrawable(0, radio, color, color);

        setBackground(DrawableUtils.newSelector(normalState, null, null, null));
    }
}
